package com.songcha.library_business.bean.book

import android.os.Parcel
import android.os.Parcelable
import com.songcha.library_network.bean.BaseListDataBean

/*"id": 1237,
"bookId": 10090,
"chapterId": 1642593,
"chapterTitle": "第1章　灵石出现",
"isVip": 0,
"words": 4223,
"displayOrder": true,
"updateTime": "1970-01-19 22:00"*/
class BookChapterCatalogBean:BaseListDataBean<BookChapterCatalogBean.DataBean>() {
    data class DataBean(val id:Int,val bookId:Int,val chapterId:Int,val chapterTitle:String,val isVip:Int,
                               val words:Int,val displayOrder:Boolean,val updateTime:String):Parcelable{
        constructor(parcel: Parcel) : this(
            parcel.readInt(),
            parcel.readInt(),
            parcel.readInt(),
            parcel.readString()?:"",
            parcel.readInt(),
            parcel.readInt(),
            parcel.readByte() != 0.toByte(),
            parcel.readString()?:""
        ) {
        }

        override fun writeToParcel(parcel: Parcel, flags: Int) {
            parcel.writeInt(id)
            parcel.writeInt(bookId)
            parcel.writeInt(chapterId)
            parcel.writeString(chapterTitle)
            parcel.writeInt(isVip)
            parcel.writeInt(words)
            parcel.writeByte(if (displayOrder) 1 else 0)
            parcel.writeString(updateTime)
        }

        override fun describeContents(): Int {
            return 0
        }

        companion object CREATOR : Parcelable.Creator<DataBean> {
            override fun createFromParcel(parcel: Parcel): DataBean {
                return DataBean(parcel)
            }

            override fun newArray(size: Int): Array<DataBean?> {
                return arrayOfNulls(size)
            }
        }

    }

}